package vip.web3.admin.sys.controller.sys;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import vip.web3.admin.sys.service.base.FileUploadService;
import vip.web3.common.utils.R;

import javax.annotation.Resource;


/**
 * 上传图片
 *
 * aut-horYJY
 * @email
 * @date 2022-12-12 14:56:17
 */
@RestController
@RequestMapping("sys/upload")
public class SysUploadController {

    @Resource
    private FileUploadService fileUploadService;

    /**
     * 列表
     */
    @PostMapping("/img")
    public R uploadImg(MultipartFile file) {
        R uploadFile = fileUploadService.uploadFile(file);
        return R.ok().put("data", uploadFile.get("dirPath"));
    }

}
